#ifndef __OperationAudio_H_ 
#define __OperationAudio_H_  

#include <gccore.h>
#include <ogcsys.h>
#include <string.h>

namespace {
   typedef struct { 
	   u32 RIFF; 
	   u32 riSize; 
	   u32 WAVE; 
	   u32 waFmt; 
	   u32 fmtSize; 
	   u16 fmtType; 
	   u16 fmtChannels; 
	   u32 fmtRate; 
	   u32 fmtSamplesPerSecond; 
	   u16 fmtBlockAlign; 
	   u16 fmtBitsPerSample; 
	   u16 fmtExtensionSize; 
   } __attribute__ ((__packed__)) WAVEHDR;  

   typedef struct { 
	   u32 WAVEDATA; 
	   u32 waSize; 
   } __attribute__ ((__packed__)) WAVEDATAHDR; 
};
   
class OperationAudio{

   public:
      OperationAudio();
	  ~OperationAudio();
	  
      void InitAudio();
	  void PlayGameMusic();
	  void StopGameMusic();
	  
	private:
	  u32 CvtWave (u8 *wavebuffer);
	  u16 FLIP16(u16 value);
	  u32 FLIP32(u32 value);
	
	  int samplerate;
	  int gamesamples;
	  bool SOUNDENABLED;

};

#endif //__OperationAudio_H_
